<template>
	<view>
		<view class="list">
			<view class="item" v-for="(item,index) in list" :key="index">
				<view class="user">
					<view class="img">
						<image :src="item.avatar" mode="aspectFill"></image>
					</view>
					<view class="info">
						<view class="info_name" ><text style="position: absolute;
                            left: 120rpx;"> {{item.nickname}}  <text class="info_time">{{item.add_time}}</text></text> 

                            <text v-if="item.giveaway_price > 0" class="info_time" style="color: #4CAF50;">＋{{item.giveaway_price}}</text>
                        
                        </view>
					</view>
				</view>
				
			</view>
		</view>
		<view class="zanwu" v-if="list.length==0" style="padding: 100upx 0;">
			<u-empty text="暂无数据" mode="list"></u-empty>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[],
				id:'',
				time:'',
				userInfo:'',
				page:1,
			}
		},
		onLoad(p) {
			this.userInfo=uni.getStorageSync('userInfo');
			this.getInvite();
		},
		onReachBottom() {
			this.getInviteS();
		},
		methods: {
            getInvite:function(){
				this.$show();
                uni.request({
					url: 'https://oa.yuxiang123.cn/api/shop_user/shop_my_invite',
					header: {
						"content-type": "application/x-www-form-urlencoded"
					},
					method: 'POST',
					data:{
						token:uni.getStorageSync('token'),
						page:this.page,
					    pagesize:'20'
					},
					success: (res) => {
						this.$hide()
					    this.list = res.data.data;
					}
				})
			},
			getInviteS:function(){
				if(this.page * 20 > this.list.length){
					return false
				}
				this.page++;
				this.$show();
                uni.request({
					url: 'https://oa.yuxiang123.cn/api/shop_user/shop_my_invite',
					header: {
						"content-type": "application/x-www-form-urlencoded"
					},
					method: 'POST',
					data:{
						token:uni.getStorageSync('token'),
						page:this.page,
					    pagesize:'20'
					},
					success: (res) => {
						this.$hide()
                        this.list = this.list.concat(res.data.data);
					}
				})
			},
        }
	}
</script>

<style lang="scss">
	.list{
		padding:0 20upx;
		.item{
			padding: 20upx 0;
			border-bottom: 2px solid #f5f5f5;
			.user{
				display: flex;
				align-items: center;
				.img{
					image{
						width: 80upx;
						height: 80upx;
						border-radius: 50%;
					}
				}
				.info{
					line-height: 40upx;
					flex: 1;
					margin-left: 20upx;
					margin-top: -35rpx;
					.info_name{
						font-size: 30upx;
						color: #333333;
                        text-align: right;
					}
					.info_time{
						font-size: 22upx;
						color: #999999;
						margin-left: 30rpx;
					}
				}
				.star{
					
				}
			}
			.content{
				.text{
					font-size: 28rpx;
					color: #000;
					margin-left: 95rpx;
				}
				.imgList{
					display: flex;
					flex-wrap: wrap;
					.imgItem{
						width: 31%;
						margin-top: 10upx;
						image{
							width: 100%;
							height: 230upx;
							border-radius: 10upx;
						}
					}
					.imgItem:nth-child(3n+2){
						margin: 0 3%;
						margin-top: 10upx;
					}
				}
			}
		}
	}
</style>
